<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<link href="css/style.css" rel="stylesheet" type="text/css" />
<style type="text/css">  
#myTable  
  {  
  font-family:"Trebuchet MS", Arial, Helvetica, sans-serif;  
  width:100%;  
  border-collapse:collapse;  
  }  
 
#myTable td, #myTable th   
  {  
  font-size:1em;  
  border:1px solid  blue;  
  padding:3px 7px 2px 7px;  
  }  
 
#myTable th   
  {  
  font-size:1.1em;  
  text-align:left;  
  padding-top:5px;  
  padding-bottom:4px;  
  background-color:#0066FF;  
  color:#ffffff;  
  }  
 
#myTable tr.alt td   
  {  
  color:#000000;  
  background-color:#EAF2D3;  
  }  
</style>  
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
  $.ajax({  
       
        type:"GET",  
        dataType: 'json',  
        url:"get/data",  
        error:function(data){  
            alert("出错了！！:"+data.msg);  
        },  
        success:function(data){  
        debugger;
			for(var o in data){
			var dt = data[o];
			var r="";
			var n="";
			var color="";
			if(dt.mark == 0){
				r = "开启";
				n = "点击关闭";
				color = "#FF0000";
			}else{
				r = "关闭";
				n = "点击开启";
				color = "#33FF00";
			}
			if(o%2==0){
				$("#myTable").append("<tr class=\"alt\"><td width=\"200\">"+dt.name+"</td><td width=\"200\">"+dt.belong+"</td><td width=\"200\">"+r+"</td><td>"+"<input type=\"button\" value=\""+n+"\" style=\"color:"+color+";\" onclick=\"doAddEmp('"+dt.mark+"','"+dt.ckid+"')\">"+"</td></tr>")
				debugger;
			}else{
				$("#myTable").append("<tr><td width=\"200\">"+dt.name+"</td><td width=\"200\">"+dt.belong+"</td><td width=\"200\">"+r+"</td><td>"+"<input type=\"button\" value=\""+n+"\" style=\"color:"+color+";\" onclick=\"doAddEmp('"+dt.mark+"','"+dt.ckid+"')\">"+"</td></tr>")
			}
				
			}
             
              
        }  
        });  
});
</script>
<script type="text/javascript">  
    function doAddEmp(value,ckid){  

	    $.ajax({  
	       
	        type:"GET",  
	        dataType: 'json', 
	        data:"value=" + value + "&ckid=" + ckid,
	        url:"get/changeValue",  
	        error:function(data){  
	            alert("出错了！！:"+data.msg);  
	        },  
	        success:function(data){  
	        window.location.reload();
	        }  
	    }); 
        
   }  
</script>

</head>


<body>

	<div class="place">
    <span>位置：</span>
    <ul class="placeul">
    <li><a href="#">首页</a></li>
    </ul>
    </div>
    
    <div class="mainindex">
    
    
    <div class="welinfo">
    <span><img src="images/sun.png" alt="天气" /></span>
    <b>欢迎使用信息管理系统</b>
    </div>
    

    
    <div class="xline"></div>
    <table id="myTable">  
		<tr>  
			<th>接口名称</th>  
			<th>发起方</th>  
			<th>状态</th>
			<th>开启/关闭</th>  
		</tr>  

		</table>
   
    
    
    </div>
</body>
</html>

